<?php
/**
 * BidAdjustmentV33
 *
 * PHP version 5
 *
 * @category Class
 * @package  AmazonAdvertisingApi
 * @author   vv_guo
 * @link    https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 */

/**
 * Amazon Ads API - Sponsored Brands
 *
 * Use the Amazon Ads API for Sponsored Brands for campaign, ad group, keyword, negative keyword, drafts, Stores, landing pages, and Brands management operations. For more information about Sponsored Brands, see the [Sponsored Brands Support Center](https://advertising.amazon.com/help#GQFZA83P55P747BZ). For onboarding information, see the [account setup](https://advertising.amazon.com/API/docs/v3/guides/account_setup) topic.
 *
 * OpenAPI spec version: 3.0
 * 
 * Generated by:https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api.git
 * AmazonAdvertisingApi Codegen version: 3.0.51
 */
/**
 * NOTE: This class is auto generated by the AmazonAdvertisingApi code generator program.
 *https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 * Do not edit the class manually.
 */

namespace AmazonAdvertisingApi\Model;

use \ArrayAccess;
use \AmazonAdvertisingApi\ObjectSerializer;

/**
 * BidAdjustmentV33 Class Doc Comment
 *
 * @category Class
 * @package  AmazonAdvertisingApi
 * @author   vv_guo
 * @link    https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 */
class BidAdjustmentV33 implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

    /**
      * The original name of the model.
      *
      * @var string
      */
    protected static $AmazonAdvertisingApiModelName = 'BidAdjustmentV3_3';

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $AmazonAdvertisingApiTypes = [
        'bid_adjustment_predicate' => 'string',
        'bid_adjustment_percent' => 'float'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $AmazonAdvertisingApiFormats = [
        'bid_adjustment_predicate' => null,
        'bid_adjustment_percent' => null
    ];

    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function AmazonAdvertisingApiTypes()
    {
        return self::$AmazonAdvertisingApiTypes;
    }

    /**
     * Array of property to format mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function AmazonAdvertisingApiFormats()
    {
        return self::$AmazonAdvertisingApiFormats;
    }

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'bid_adjustment_predicate' => 'bidAdjustmentPredicate',
        'bid_adjustment_percent' => 'bidAdjustmentPercent'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'bid_adjustment_predicate' => 'setBidAdjustmentPredicate',
        'bid_adjustment_percent' => 'setBidAdjustmentPercent'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'bid_adjustment_predicate' => 'getBidAdjustmentPredicate',
        'bid_adjustment_percent' => 'getBidAdjustmentPercent'
    ];

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @return array
     */
    public static function attributeMap()
    {
        return self::$attributeMap;
    }

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @return array
     */
    public static function setters()
    {
        return self::$setters;
    }

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @return array
     */
    public static function getters()
    {
        return self::$getters;
    }

    /**
     * The original name of the model.
     *
     * @return string
     */
    public function getModelName()
    {
        return self::$AmazonAdvertisingApiModelName;
    }

    const BID_ADJUSTMENT_PREDICATE_PLACEMENT_GROUP_DETAIL_PAGE = 'placementGroupDetailPage';
    const BID_ADJUSTMENT_PREDICATE_PLACEMENT_GROUP_HOME = 'placementGroupHome';
    const BID_ADJUSTMENT_PREDICATE_PLACEMENT_GROUP_OTHER = 'placementGroupOther';
    const BID_ADJUSTMENT_PREDICATE_SHOPPER_SEGMENT_NEW_TO_BRAND_PURCHASE = 'shopperSegmentNewToBrandPurchase';

    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getBidAdjustmentPredicateAllowableValues()
    {
        return [
            self::BID_ADJUSTMENT_PREDICATE_PLACEMENT_GROUP_DETAIL_PAGE,
            self::BID_ADJUSTMENT_PREDICATE_PLACEMENT_GROUP_HOME,
            self::BID_ADJUSTMENT_PREDICATE_PLACEMENT_GROUP_OTHER,
            self::BID_ADJUSTMENT_PREDICATE_SHOPPER_SEGMENT_NEW_TO_BRAND_PURCHASE,
        ];
    }

    /**
     * Associative array for storing property values
     *
     * @var mixed[]
     */
    protected $container = [];

    /**
     * Constructor
     *
     * @param mixed[] $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(array $data = null)
    {
        $this->container['bid_adjustment_predicate'] = isset($data['bid_adjustment_predicate']) ? $data['bid_adjustment_predicate'] : null;
        $this->container['bid_adjustment_percent'] = isset($data['bid_adjustment_percent']) ? $data['bid_adjustment_percent'] : null;
    }

    /**
     * Show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     */
    public function listInvalidProperties()
    {
        $invalidProperties = [];

        $allowedValues = $this->getBidAdjustmentPredicateAllowableValues();
        if (!is_null($this->container['bid_adjustment_predicate']) && !in_array($this->container['bid_adjustment_predicate'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'bid_adjustment_predicate', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        return $invalidProperties;
    }

    /**
     * Validate all the properties in the model
     * return true if all passed
     *
     * @return bool True if all properties are valid
     */
    public function valid()
    {
        return count($this->listInvalidProperties()) === 0;
    }


    /**
     * Gets bid_adjustment_predicate
     *
     * @return string
     */
    public function getBidAdjustmentPredicate()
    {
        return $this->container['bid_adjustment_predicate'];
    }

    /**
     * Sets bid_adjustment_predicate
     *
     * @param string $bid_adjustment_predicate Determines the predicate (placement groups and shopper segments) that the bid adjustment will be made for. |BidAdjustmentPredicate|Description| |------|-----------| |PLACEMENT_GROUP_DETAIL_PAGE|Predicate for adjusting bids at detail page placement.| |PLACEMENT_GROUP_HOME|Predicate for adjusting bids at home page placement.| |PLACEMENT_GROUP_OTHER|Predicate for adjusting bids at pages other than detail and home pages placement.| |SHOPPER_SEGMENT_NEW_TO_BRAND_PURCHASE|Predicate for adjusting bids for new-to-brand purchase shopper segment.|
     *
     * @return $this
     */
    public function setBidAdjustmentPredicate($bid_adjustment_predicate)
    {
        $allowedValues = $this->getBidAdjustmentPredicateAllowableValues();
        if (!is_null($bid_adjustment_predicate) && !in_array($bid_adjustment_predicate, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'bid_adjustment_predicate', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['bid_adjustment_predicate'] = $bid_adjustment_predicate;

        return $this;
    }

    /**
     * Gets bid_adjustment_percent
     *
     * @return float
     */
    public function getBidAdjustmentPercent()
    {
        return $this->container['bid_adjustment_percent'];
    }

    /**
     * Sets bid_adjustment_percent
     *
     * @param float $bid_adjustment_percent Bid adjustment for placement groups and shopper segments. Value is a percentage to two decimal places. For bid adjustments in placement groups, min is -99.00 and max is 900.00. For bid adjustments in shopper segments, min is 0.00 and max is 900.00. For example: If -40.00 is set for a $5.00 bid, the resulting bid is $3.00.
     *
     * @return $this
     */
    public function setBidAdjustmentPercent($bid_adjustment_percent)
    {
        $this->container['bid_adjustment_percent'] = $bid_adjustment_percent;

        return $this;
    }
    /**
     * Returns true if offset exists. False otherwise.
     *
     * @param integer $offset Offset
     *
     * @return boolean
     */
    #[\ReturnTypeWillChange]
    public function offsetExists($offset)
    {
        return isset($this->container[$offset]);
    }

    /**
     * Gets offset.
     *
     * @param integer $offset Offset
     *
     * @return mixed
     */
    #[\ReturnTypeWillChange]
    public function offsetGet($offset)
    {
        return isset($this->container[$offset]) ? $this->container[$offset] : null;
    }

    /**
     * Sets value based on offset.
     *
     * @param integer $offset Offset
     * @param mixed   $value  Value to be set
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetSet($offset, $value)
    {
        if (is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }

    /**
     * Unsets offset.
     *
     * @param integer $offset Offset
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetUnset($offset)
    {
        unset($this->container[$offset]);
    }

    /**
     * Gets the string presentation of the object
     *
     * @return string
     */
    public function __toString()
    {
        if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
            return json_encode(
                ObjectSerializer::sanitizeForSerialization($this),
                JSON_PRETTY_PRINT
            );
        }

        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
    }
}
